package com.csweimei.rentmanagementtreasure.pop;

import android.content.Context;
import android.widget.EditText;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.csweimei.rentmanagementtreasure.R;
import com.lxj.xpopup.core.CenterPopupView;

public class PopInput extends CenterPopupView {

    private Context mContext;
    private TextView title,sure,cancel;
    private EditText edtContent;
    private PopSelClick mPopSelClick;
    private String titleS;


    public PopInput(@NonNull Context context,PopSelClick popSelClick) {
        super(context);
        this.mContext = context;
        this.mPopSelClick = popSelClick;
    }

    public void setTitle(String t){
        titleS = t;
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.pop_input;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        title = findViewById(R.id.title);
        sure = findViewById(R.id.sure);
        cancel = findViewById(R.id.cancel);
        edtContent = findViewById(R.id.edt_content);
        title.setText(titleS);

        sure.setOnClickListener(v -> {
            if (mPopSelClick != null){
                mPopSelClick.sel(new PopBean(edtContent.getText().toString()));
            }
            dismiss();
        });


        cancel.setOnClickListener(v -> {
            dismiss();
        });



    }
}
